# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
pkgname=khtml
pkgver=5.113.0
pkgrel=0
pkgdesc="The KDE HTML library, ancestor of WebKit"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-or-later AND LGPL-2.1-only"
depends_dev="
	giflib-dev
	karchive5-dev
	kcodecs5-dev
	kglobalaccel5-dev
	ki18n5-dev
	kiconthemes5-dev
	kio5-dev
	kjs-dev
	knotifications5-dev
	kparts5-dev
	ktextwidgets5-dev
	kwallet5-dev
	kwidgetsaddons5-dev
	kwindowsystem5-dev
	kxmlgui5-dev
	libjpeg-turbo-dev
	perl-dev
	qt5-qtbase-dev
	sonnet5-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	gperf
	samurai
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/frameworks/khtml.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/portingAids/khtml-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	xvfb-run ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
5588dd06dfbdfb82032404b7d350485220457d8548b68b6bb032caa444ffe36ccc4fcce7391b66a7b93ee6352e54acf0c3b47e63afd6d780afb1ae64c5de1a27  khtml-5.113.0.tar.xz
"
